<template>
  <div>
    <!-- 面包屑 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 卡片 -->
    <el-card class="box-card">
      <el-table :data="rightsDataList" style="width: 100%" stripe border>
        <el-table-column type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column  label="权限等级">
          <template slot-scope="scope">
          {{ scope.row.lenght}}
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag v-else-if="scope.row.level ==='1'" type="success">二级</el-tag>
            <el-tag v-else type="warning">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  created()
  {
this.reqRightsData();
  },
  data(){
    return {
      rightsDataList:[],
    }
  },
  methods:{
    reqRightsData(){
      this.$httpReq.get('rights/list')
      .then(res => {
         if (res.meta.status == 200) {
            this.rightsDataList = res.data;
          } else {
            var msg = res.meta.msg;
            this.$message.error(msg);
          }
      });
    }
  }
};
</script>

<style>
</style>